//
//  UIBarButtonItem+Extension.swift
//  Weibo
//
//  Created by 孙明海 on 16/2/28.
//  Copyright © 2016年 孙明海. All rights reserved.
//

import UIKit


extension UIBarButtonItem {
    convenience init(imageName: String, target: AnyObject?, actionName: String?) {
        let button = UIButton(imageName: imageName, backImageName: nil)
        
        if let actionName = actionName {
            button.addTarget(target, action: Selector(actionName), forControlEvents: .TouchUpInside)
        }
        
        self.init(customView: button)
    }
}